package com.uu.safeguard.dao;

import com.uu.safeguard.entity.Member;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.LinkedHashMap;
import java.util.List;

/**
 * (Member)表数据库访问层
 *
 * @author makejava
 * @since 2021-03-19 09:59:58
 */
@Mapper
public interface MemberDao {
    /**
     * @Description: 查询超级权限
     * @Param: [sn]
     **/
    LinkedHashMap<String,Object> findMemberRoleId(String sn);
    /**
     * @Description: 搜索用户
     * @Param: [memberSn]
     **/
    LinkedHashMap<String,Object> searchMemberBySn(String memberSn);
    /**
     * @Description: 查询高级身份
     * @Param: [sn]
     **/
    LinkedHashMap<String,Object> findAdvancedIdentity(String sn);
    /**
     * @Description: 权限校验用户
     * @Param: [sn]
     **/
    LinkedHashMap<String,Object> findMemberBySn(String sn);
    /**
     * @Description: 用户数量饼状图
     * @Param: [operatorMemberSn, projectSn]
     **/
    LinkedHashMap<String,Object> findMemberPieChart(String operatorMemberSn,String projectSn);
    /**
     * @Description: 余额柱状图
     * @Param: [operatorMemberSn, projectSn]
     **/
    LinkedHashMap<String,Object> findBalanceHistogram(String operatorMemberSn,String projectSn);

    /**
     * @Description: 某运营商某小区新增用户数
     * @Param: [operatorMemberSn, projectSn, startTime, endTime]
     **/
    LinkedHashMap<String,Object> findMemberNewlyAddedOneDay(String operatorMemberSn,String projectSn,Long startTime,Long endTime);

    /**
     * @Description: 余额转让金额总计
     * @Param: [sn]
     **/
    LinkedHashMap<String,Object> findBalanceMoveAll(String sn);
    /**
     * @Description: 余额转账列表
     * @Param: [sn, startIndex, endIndex]
     **/
    List<LinkedHashMap<String,Object>> findBalanceMoveList(String sn,int startIndex, int endIndex);
    Integer findBalanceMoveListCount(String sn);
    /**
     * @Description: 用户充值列表
     * @Param: [sn, startIndex, endIndex]
     **/
    List<LinkedHashMap<String,Object>> findMemberRechargeList(String operatorMemberSn,String projectSn,String sn,int startIndex, int endIndex);
    Integer findMemberRechargeListCount(String operatorMemberSn,String projectSn,String sn);
    /**
     * @Description: 项目用户消费利润列表
     * @Param: [sn, startIndex, endIndex]
     **/
    List<LinkedHashMap<String,Object>> findMemberConsumeList(String operatorMemberSn,String projectSn,String stationSn,String sn,int startIndex, int endIndex);
    Integer findMemberConsumeListCount(String operatorMemberSn,String projectSn,String stationSn,String sn);
    /**
     * @Description: 查询用户余额转让次数
     * @Param: [sn]
     **/
    LinkedHashMap<String,Object> findMemberMoneyMakeOver(String sn);
    /**
     * @Description: 查询用户充电状态
     * @Param: [sn]
     **/
    LinkedHashMap<String,Object> findMemberIsCharge(String sn);
    /**
     * @Description: 查询用户充值次数及充值金额
     * @Param: [sn]
     **/
    LinkedHashMap<String,Object> findMemberRechargeMsg(String sn,String operatorMemberSn);
    /**
     * @Description: 查询用户消费次数及消费金额
     * @Param: [sn]
     **/
    LinkedHashMap<String,Object> findMemberConsumeMsg(String sn,String operatorMemberSn,String stationSn);

    /**
     * @Description: 查询用户和所在小区
     * @Param: [sn, projectSn]
     **/
    LinkedHashMap<String,Object> findMemberAndProject(String sn);
    /**
     * @Description: 小区用户明细（注册时间 账号 手机号）
     * @Param: [sn, projectSn, keywords, startIndex, endIndex]
     **/
    List<LinkedHashMap<String,Object>> findProjectUserList(String sn,String projectSn,String keywords,int startIndex, int endIndex);
    Integer findProjectUserListCount(String sn,String projectSn,String keywords);
    /**
     * @Description: 小区挂失
     * @Param: [sn, projectSn]
     **/
    LinkedHashMap<String,Object> findMyUserLose(String sn,String projectSn);
    /**
     * @Description: 小区退款用户
     * @Param: [sn, projectSn]
     **/
    LinkedHashMap<String,Object> findMyUserRefund(String sn,String projectSn);
    /**
     * @Description: 各项目用户对比
     * @Param: [sn, timeStamp, projectSn]
     **/
    List<LinkedHashMap<String,Object>> findMyUserProjectContrast(String sn,long timeStamp,String projectSn);
    //分页
    List<LinkedHashMap<String,Object>> findMyUserProjectContrast(String sn,long timeStamp,Integer startIndex, Integer endIndex);
    //总数统计
    Integer findMyUserProjectContrastCount(String sn,long timeStamp,String projectSn);

    /**
     * @Description: 某月用户消费
     * @Param: [sn, timeStamp, projectSn]
     **/
    List<LinkedHashMap<String,Object>> findMyUserMonthFrequency(String sn,long timeStampStart,long timeStampEnd,String projectSn);

    /**
     * @Description: 我的用户变化曲线
     * @Param: [sn, timeStamp, projectSn]
     **/
    List<LinkedHashMap<String,Object>> findMyUserChangeCurve(String sn,long timeStamp,String projectSn);

    /**
     * @Description: 我的用户数据统计
     * @Param: [sn]
     **/
    LinkedHashMap<String,Object> findMyUserStatistics(String sn,long timeStamp,String projectSn);

    /**
     * @Description: 我的用户消费
     * @Param: [sn]
     **/
    LinkedHashMap<String,Object> findMyUserConsume(String sn,String projectSn);

    /**
     * 通过ID查询单条数据
     *
     * @param sn 主键
     * @return 实例对象
     */
    Member queryBySn(String sn);

    /**
     * 查询指定行数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    List<Member> queryAllByLimit(@Param("offset") int offset, @Param("limit") int limit);
    /**
     * 查询指定行数据
     *
     * @return 对象列表
     */
    List<Member> queryByList(int startIndex,int endIndex);


    /**
     * 通过实体作为筛选条件查询
     *
     * @param member 实例对象
     * @return 对象列表
     */
    List<Member> queryAll(Member member);

    /**
     * 新增数据
     *
     * @param member 实例对象
     * @return 影响行数
     */
    int insert(Member member);

    /**
     * 修改数据
     *
     * @param member 实例对象
     * @return 影响行数
     */
    int update(Member member);

    /**
     * 通过主键删除数据
     *
     * @param sn 主键
     * @return 影响行数
     */
    int deleteBySn(String sn);

    List<LinkedHashMap<String,Object>> queryBySnList(String sn);

}